package com.gitee.wsl.struct.command.testing

import com.gitee.wsl.struct.command.internal.UsageError
import com.gitee.wsl.struct.command.output.Localization
import com.gitee.wsl.struct.command.output.ParameterFormatter


val Throwable.formattedMessage: String?
    get() = (this as? UsageError)?.formatMessage(
        context?.localization ?: defaultLocalization,
        ParameterFormatter.Plain
    ) ?: message

internal val defaultLocalization = object : Localization {}
